package com.github.ylt.utils;

/**
 * @author wutong
 */
public class SOAPUtils {
    private SOAPUtils(){}
    private static class SingletonHolder{
        private static final SOAPUtils INSTANCE = new SOAPUtils();
    }
    public static SOAPUtils getInstance(){
        return SingletonHolder.INSTANCE;
    }

    public String buildBody(String body,String action,String method){
        StringBuilder builder = new StringBuilder("<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">");
        builder.append("<s:Body>");
        builder.append(" <u:"+method+"Response xmlns:u=\""+action+":1\">");
        builder.append(body);
        builder.append("</u:"+method+"Response>");
        builder.append("</s:Body>");
        builder.append("</s:Envelope>");
        return builder.toString();
    }
}
